<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
    // let [a,b,c] = [1,2,3];
    // let [a,,b] = [1,2,3]
    // console.log(a);
    // console.log(b);
    // console.log(c);
    // let [a,b,c,d,...e] = "hello world";
    // console.log(a);
    // console.log(b);
    // console.log(c);
    // console.log(d);
    // console.log(e);
    // let [a=1,b=a] =[];  // a=1 b=1
  
    
    // let [a=1,b=a] =[2];// a = 2 b = 2
    // let [a=1,b=a] =[2,3];// a = 2 b= 3
    // console.log(a,b);
    // let {bar:foo} = {foo1:'aaa',bar:'ddd'};
    // // console.log(bar);
    // console.log(foo);
    let obj ={p:['hello',{y:'world'}]};
    //可嵌套
    // let {p:[x,{y}]} = obj;//可嵌套
    //x = hello y = world
    let {p:[x,{}]} = obj;//可忽略
    //x = hello
    console.log(x);
    console.log(y);
    </script>
</body>
</html>